<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class FhHonor extends Model
{
	
    protected $table = 'fh_honors';
    protected $fillable = ['p_id', 'name', 'imgst','thumb'];

    public static function boot()
    {
        parent::boot();

        static::saving(function ($model) {
            $thumb=explode(".", $model->imgst);
            $model->thumb = $thumb[0].'-small.'.$thumb[1];
        });
    }


    public function parents(){
        return $this->belongsTo(FhAbout::class, 'p_id');
    }
}
